package com.example.demo.listener;

import com.example.demo.config.DirectRabbitConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class DirectListener {

    private static Logger logger = LoggerFactory.getLogger(DirectListener.class);

    @RabbitHandler
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(DirectRabbitConfig.DIRECT_QUEUE),
            exchange = @Exchange(value = DirectRabbitConfig.DIRECT_EXCHANGE),
            key = DirectRabbitConfig.DIRECT_ROUTING_KEY
    ))
    public void directOnMessage1(Map message) {
        logger.info("DirectListener received.message:{}", message.toString());
    }

}